package com.zhou.gof.group.singleton;

/**
 * @author zhoudong
 * @title: SingletonIdler
 * @projectName user-app
 * @description: 单利模式，懒汉，双重锁效验（DCL），线程安全
 * @date 2019/5/29 14:48
 */
public class SingletonIdler {
    private volatile static SingletonIdler singletonIdler;
    private SingletonIdler(){}

    public static SingletonIdler getInstance(){
        if(singletonIdler == null){
            synchronized (SingletonIdler.class){
                if (singletonIdler == null){
                    singletonIdler = new SingletonIdler();
                }
            }
        }
        return singletonIdler;
    }

    public void msg(){
        System.out.println("单例模式-懒汉式");
    }
}
